# #编写一个函数 求1+2+3+。。。+n的和

# def add_num(x1):
#     sum1=0
#     a=range(1,x1+1)
#     for each in a:
#         sum1=sum1+each
#     print(sum1)
# add_num(4)

# #编写一个函数求多个数中的最大值
# def max_num(*args):
#     a1=max(*args)
#     print(a1)

# max_num(1,2,5)

# #编写一个函数 实现姚塞子
# import random
# def dice_num(x3):
#     sum2=0
#     a3=range(1,x3+1)
#     for _each in a3:
#         _num =random.randint(1,6)
#         sum2+=_num
#     print(sum2)
# dice_num(3)

# #交换key和veal
# def dict1(x1):
#     a={k1:v1 for v1,k1 in x1.items()}
#     print(a)

# dict1({'x':2})

# 编写一个函数，提取字符串中的所有字母，然后拼接成一个新的字符串
# def str_list(x1):
#     x11=""
#     for _each in x1:
#         if _each.isalpha():
#             x11+=_each


#     print(x11)

# str_list('ssa774514ass5d8a')

# def sum_001(*args):
#     a=len(args)
#     b=0
#     while a>0:
#         b+=args[a-1]
#         a-=1
#     print(b)

# sum_001(1,2,3,4)

# def upper_1(x1):
#     if x1[0].isalpha():
#         a=x1[0].upper()

#         print(a+x1[1:])
#     else:
#         print(x1)

# upper_1('ss2233sss')

# def end_with(x1,x2):
#     x3=len(x2)
#     print(x1[-len(x2):])
#     if (x1[-len(x2):]) == x2:
#         print('yes')
#     else:
#         print('no')

# end_with('asdfgh','gh')

# def isdigit_1(x1):
#     for _eaac in x1:
#         if not '0' <= _eaac <= '9':
#             return False

#     return True


# isdigit_1('22222')..000.__init__
# def rjust_1(x1,x2,x3):
#     aa=None
#     i=0
#     if x2>len(x1):
#         x4=x2-len(x1)
#         aa=x3*x4
#     print(aa+x1)

# rjust_1('sss',8,'k')


# def index_1(str1, str2):
#     x1=[]
#     for i,_each in enumerate(str1):
#         if _each == str2:
#             x1.append(i)
#     print(x1)

# index_1('sssaaassaasdww','a')
    
# def in_1(str1,str2):
#     i=0
#     for _each in str1:
#         i+=1
#         if _each ==str2:
#             print('ok')
#             break
        
#     else:
#         print('no')
#     print(i)
# in_1([22,33,44],222)


# def replace_1(old,old2,new):
#     len_new=len(old2)
#     kk1=len(old)
#     old1=list(old)
#     while kk1>0:
#         for i,_each in enumerate(old1):
#             kk1-=1
#             if _each == old2[0]:
#                 print(i)
#                 # print(old[i,i+len_new])
#                 # pass
#                 if old[i:i+len_new]==old2:
#                     a1=new.join(old.split(old2))
#                     print(a1)
                    
#                     # a1[1]= new
#                     # a2=''.join(a1)
#                     # print(a2)
#                     # continue
                
                



# replace_1('sasaaassssaase','s','hekko')